﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;
using iMall.AtoZ.Helper;

namespace iMall.AtoZ.DoPost
{
    public partial class DoPost : System.Web.UI.Page
    {
        protected void Page_Load ( object sender, EventArgs e )
        {
            string t = this.Request.QueryString["t"];
            string re = "";
            switch ( t )
            {
                case "1":
                    {
                        re = GetAllMerchant();
                        break;
                    }
                case "10":
                    {
                        re = "{}";
                        break;
                    }
            }

            this.Response.Write(re);
        }

        private string GetAllMerchant ( )
        {
            string re = string.Empty;
            IDAL<MerchantEntity> dal = DALFactory.GetMerchantDAL();
            List<MerchantEntity> li = dal.GetAll();

            if ( li != null )
            {
                re = JsonConvert.SerializeObject(li);
            }

            return re;
        }
    }
}